<h2>Search<?php if (!empty($this->q)) { echo ': '.$this->q; } ?></h2>

<form method="get" action="/store/search">
    <label for="q">Search:</label>
    <input type="text" name="q" id="q" value="<?php echo $this->q; ?>" size="50" maxlength="200"/>
</form>

<?php if ($this->resourceList->total_results > 0) { ?>
<div>
Total Results = <?php echo $this->resourceList->total_results; ?>
</div>

<table>
    <thead>
        <tr>
            <th>Subject</th>
            <th>Type(s)</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($this->resourceList->items as $item) { ?>
            <?php $link = $item['http://purl.org/rss/1.0/link'][0]; ?>
            <?php $types = $item['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']?>
            <?php $types = array_diff($types, array('http://purl.org/rss/1.0/item')); ?>
            <tr>
                <td><a href="/store/browse?uri=<?php echo urlencode($link); ?>"><?php echo $link; ?></a></td>
                <td><?php echo implode('<br/>', $types); ?></td>
            </tr>
        <?php } ?>
    </tbody>
</table>
<?php } else { ?>
    <?php if (!empty($this->q)) { ?>
        <p>No results found</p>
    <?php } ?>
<?php } ?>